/**
 * Copyright 2019-2020 Huawei Technologies Co., Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef FUSION_ENGINE_OPTIMIZER_GRAPH_OPTIMIZER_SHAPE_FORMAT_TRANSFER_TRANS_NODE_MANAGER_TRANS_NODE_INSERTION_INSERT_TRANS_NODE_STRATEGY_H_
#define FUSION_ENGINE_OPTIMIZER_GRAPH_OPTIMIZER_SHAPE_FORMAT_TRANSFER_TRANS_NODE_MANAGER_TRANS_NODE_INSERTION_INSERT_TRANS_NODE_STRATEGY_H_
#include <map>
#include "common/math_util.h"

namespace fe {
#define SRC_FORMAT(num) ((uint32_t)num << BIT_SHIFT_8)
enum InsertionMode {
  INSERT_TRANS_NODE_BY_ORIGINAL_FORMAT_FRONT = 0,
  INSERT_TRANS_NODE_BY_ORIGINAL_FORMAT_END = 1,
  INSERT_TRANS_NODE_BY_CONSECUTIVE_PRINCIPLE = 2,
  INSERTION_MODE_BOTTOM
};

const uint32_t DEFAULT_LOW_TO_HIGH_STRATEGY = 0xffffffff;
const uint32_t DEFAULT_HIGH_TO_LOW_STRATEGY = 0xfffffffe;

using strategy_id_map = std::map<uint64_t, std::vector<uint32_t>>;

enum TransFormIndex {
  RESHAPE_INDEX = 0,
  TRANSPOSE_INDEX = 1,
  CAST_INDEX = 2,
  TRANSDATA_INDEX = 3,
  REFORMAT_INEDX = 4,
  FORBIDDEN_INDEX = 5
};

const strategy_id_map STRATEGY_ORIGINAL_FORMAT_FRONT = {

};

const strategy_id_map STRATEGY_ORIGINAL_FORMAT_BACK = {

};

const strategy_id_map STRATEGY_CONSECUTIVE_PRINCIPLE = {
    /* insert all trans nodes from reshape */
    {DEFAULT_LOW_TO_HIGH_STRATEGY, {RESHAPE_INDEX, TRANSPOSE_INDEX, CAST_INDEX, TRANSDATA_INDEX}},
    /* insert all trans nodes from transdata */
    {DEFAULT_HIGH_TO_LOW_STRATEGY, {TRANSDATA_INDEX, CAST_INDEX, TRANSPOSE_INDEX, RESHAPE_INDEX}},

    /* NCHW to NHWC */
    {SRC_FORMAT(ge::FORMAT_NCHW) | ge::FORMAT_NHWC, {TRANSDATA_INDEX}},
    /* NCHW to HWCN */
    {SRC_FORMAT(ge::FORMAT_NCHW) | ge::FORMAT_HWCN, {TRANSDATA_INDEX}},
    /* NHWC to CHWN */
    {SRC_FORMAT(ge::FORMAT_NCHW) | ge::FORMAT_CHWN, {TRANSDATA_INDEX}},
    /* NCHW to NCHW */
    {SRC_FORMAT(ge::FORMAT_NCHW) | ge::FORMAT_NCHW, {}},
    /* NCHW to NC1HWC0 */
    {SRC_FORMAT(ge::FORMAT_NCHW) | ge::FORMAT_NC1HWC0, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    /* NCHW to Fractal_Z */
    {SRC_FORMAT(ge::FORMAT_NCHW) | ge::FORMAT_FRACTAL_Z, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    /* NCHW to NC1HWC0_C04 */
    {SRC_FORMAT(ge::FORMAT_NCHW) | ge::FORMAT_NC1HWC0_C04, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    /* NCHW to Fractal_Z_C04 */
    {SRC_FORMAT(ge::FORMAT_NCHW) | ge::FORMAT_FRACTAL_Z_C04, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    /* NCHW to C1HWNCoC0 */
    {SRC_FORMAT(ge::FORMAT_NCHW) | ge::FORMAT_C1HWNCoC0, {TRANSPOSE_INDEX, TRANSDATA_INDEX}},
    /* NCHW to FRACTAL_NZ */
    {SRC_FORMAT(ge::FORMAT_NCHW) | ge::FORMAT_FRACTAL_NZ, {REFORMAT_INEDX, TRANSDATA_INDEX}},

    /* NHWC to NCHW */
    {SRC_FORMAT(ge::FORMAT_NHWC) | ge::FORMAT_NCHW, {TRANSDATA_INDEX}},
    /* NHWC to HWCN */
    {SRC_FORMAT(ge::FORMAT_NHWC) | ge::FORMAT_HWCN, {TRANSDATA_INDEX}},
    /* NHWC to NHWC */
    {SRC_FORMAT(ge::FORMAT_NHWC) | ge::FORMAT_NHWC, {}},
    /* NHWC to CHWN */
    {SRC_FORMAT(ge::FORMAT_NHWC) | ge::FORMAT_CHWN, {TRANSDATA_INDEX}},
    /* NHWC to NC1HWC0 */
    {SRC_FORMAT(ge::FORMAT_NHWC) | ge::FORMAT_NC1HWC0, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    /* NHWC to Fractal_Z, NHWC to NCHW then to Fractal_Z,
     * Dtype does ot Change */
    {SRC_FORMAT(ge::FORMAT_NHWC) | ge::FORMAT_FRACTAL_Z, {TRANSPOSE_INDEX, TRANSDATA_INDEX, RESHAPE_INDEX}},
    /* NHWC to NC1HWC0_C04 */
    {SRC_FORMAT(ge::FORMAT_NHWC) | ge::FORMAT_NC1HWC0_C04, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    /* NHWC to Fractal_Z_C04 */
    {SRC_FORMAT(ge::FORMAT_NHWC) | ge::FORMAT_FRACTAL_Z_C04, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    /* NHWC to C1HWNCoC0 */
    {SRC_FORMAT(ge::FORMAT_NHWC) | ge::FORMAT_C1HWNCoC0, {TRANSPOSE_INDEX, TRANSDATA_INDEX}},
    /* NHWC to FRACTAL_NZ */
    {SRC_FORMAT(ge::FORMAT_NHWC) | ge::FORMAT_FRACTAL_NZ, {REFORMAT_INEDX, TRANSDATA_INDEX}},

    /* HWCN to NC1HWC0 */
    {SRC_FORMAT(ge::FORMAT_HWCN) | ge::FORMAT_NC1HWC0, {RESHAPE_INDEX, TRANSPOSE_INDEX, TRANSDATA_INDEX}},
    /* HWCN to Fractal_Z */
    {SRC_FORMAT(ge::FORMAT_HWCN) | ge::FORMAT_FRACTAL_Z, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    /* HWCN to NC1HWC0_C04 */
    {SRC_FORMAT(ge::FORMAT_HWCN) | ge::FORMAT_NC1HWC0_C04, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    /* HWCN to Fractal_Z_C04 */
    {SRC_FORMAT(ge::FORMAT_HWCN) | ge::FORMAT_FRACTAL_Z_C04, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    /* HWCN to HWCN */
    {SRC_FORMAT(ge::FORMAT_HWCN) | ge::FORMAT_HWCN, {}},
    /* HWCN to C1HWNCoC0 */
    {SRC_FORMAT(ge::FORMAT_HWCN) | ge::FORMAT_C1HWNCoC0, {TRANSDATA_INDEX}},
    /* HWCN to NCHW */
    {SRC_FORMAT(ge::FORMAT_HWCN) | ge::FORMAT_NCHW, {TRANSDATA_INDEX}},
    /* HWCN to NHWC */
    {SRC_FORMAT(ge::FORMAT_HWCN) | ge::FORMAT_NHWC, {TRANSDATA_INDEX}},
    /* HWCN to FRACTAL_NZ */
    {SRC_FORMAT(ge::FORMAT_HWCN) | ge::FORMAT_FRACTAL_NZ, {REFORMAT_INEDX, TRANSDATA_INDEX}},
    /* HWCN to FORMAT_FRACTAL_ZN_LSTM */
    {SRC_FORMAT(ge::FORMAT_HWCN) | ge::FORMAT_FRACTAL_ZN_LSTM, {TRANSDATA_INDEX}},

    /* NC1HWC0 to NCHW */
    {SRC_FORMAT(ge::FORMAT_NC1HWC0) | ge::FORMAT_NCHW, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    /* NC1HWC0 to NHWC */
    {SRC_FORMAT(ge::FORMAT_NC1HWC0) | ge::FORMAT_NHWC, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    /* NC1HWC0 to HWCN, to NCHW then to HWCN */
    {SRC_FORMAT(ge::FORMAT_NC1HWC0) | ge::FORMAT_HWCN, {TRANSDATA_INDEX, TRANSPOSE_INDEX, RESHAPE_INDEX}},
    /* NC1HWC0 to NC1HWC0 */
    {SRC_FORMAT(ge::FORMAT_NC1HWC0) | ge::FORMAT_NC1HWC0, {}},
    /* NC1HWC0 to Fractal_Z,
     * to NCHW first, then to Fractal_Z */
    {SRC_FORMAT(ge::FORMAT_NC1HWC0) | ge::FORMAT_FRACTAL_Z, {TRANSDATA_INDEX, TRANSDATA_INDEX, RESHAPE_INDEX}},
    /* NC1HWC0 to FRACTAL_NZ,
     * to NCHW first, then to FRACTAL_NZ */
    {SRC_FORMAT(ge::FORMAT_NC1HWC0) | ge::FORMAT_FRACTAL_NZ, {TRANSDATA_INDEX, TRANSDATA_INDEX}},
    /* NC1HWC0 to ND */
    {SRC_FORMAT(ge::FORMAT_NC1HWC0) | ge::FORMAT_ND, {FORBIDDEN_INDEX}},

    /* NC1HWC0_C04 to NCHW */
    {SRC_FORMAT(ge::FORMAT_NC1HWC0_C04) | ge::FORMAT_NCHW, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    /* NC1HWC0_C04 to NHWC */
    {SRC_FORMAT(ge::FORMAT_NC1HWC0_C04) | ge::FORMAT_NHWC, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    /* NC1HWC0_C04 to HWCN */
    {SRC_FORMAT(ge::FORMAT_NC1HWC0_C04) | ge::FORMAT_HWCN, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    /* NC1HWC0_C04 to NC1HWC0_C04 */
    {SRC_FORMAT(ge::FORMAT_NC1HWC0_C04) | ge::FORMAT_NC1HWC0_C04, {}},

    /* Fractal_Z to HWCN */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z) | ge::FORMAT_HWCN, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    /* Fractal_Z to NCHW */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z) | ge::FORMAT_NCHW, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    /* Fractal_Z to NHWC, Fractal_Z to NCHW first,
     * then to NHWC */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z) | ge::FORMAT_NHWC, {RESHAPE_INDEX, TRANSDATA_INDEX, TRANSPOSE_INDEX}},
    /* Fractal_Z to CHWN, Fractal_Z to NCHW first,
     * then to CHWN Dtype does ot Change */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z) | ge::FORMAT_CHWN, {RESHAPE_INDEX, TRANSDATA_INDEX, TRANSPOSE_INDEX}},
    /* Fractal_Z to Fractal_Z */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z) | ge::FORMAT_FRACTAL_Z, {RESHAPE_INDEX}},
    /* Fractal_Z to NC1HWC0,
     * to NCHW first, then to NC1HWC0 */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z) | ge::FORMAT_NC1HWC0, {TRANSDATA_INDEX, TRANSDATA_INDEX}},
    /* Fractal_Z to FRACTAL_NZ,
     * to NCHW first, then to FRACTAL_NZ */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z) | ge::FORMAT_FRACTAL_NZ, {TRANSDATA_INDEX, TRANSDATA_INDEX}},

    /* Fractal_Z_C04 to NCHW */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z_C04) | ge::FORMAT_NCHW, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    /* Fractal_Z_C04 to NHWC */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z_C04) | ge::FORMAT_NHWC, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    /* Fractal_Z_C04 to HWCN */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z_C04) | ge::FORMAT_HWCN, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    /* Fractal_Z_C04 to Fractal_Z_C04 */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z_C04) | ge::FORMAT_FRACTAL_Z_C04, {RESHAPE_INDEX}},

    /* C1HWNCoC0 to C1HWNCoC0 */
    {SRC_FORMAT(ge::FORMAT_C1HWNCoC0) | ge::FORMAT_C1HWNCoC0, {}},
    /* C1HWNCoC0 to HWCN */
    {SRC_FORMAT(ge::FORMAT_C1HWNCoC0) | ge::FORMAT_HWCN, {TRANSDATA_INDEX}},
    /* C1HWNCoC0 to NCHW */
    {SRC_FORMAT(ge::FORMAT_C1HWNCoC0) | ge::FORMAT_NCHW, {TRANSDATA_INDEX, TRANSPOSE_INDEX}},
    /* C1HWNCoC0 to NHWC */
    {SRC_FORMAT(ge::FORMAT_C1HWNCoC0) | ge::FORMAT_NHWC, {TRANSDATA_INDEX, TRANSPOSE_INDEX}},
    /* C1HWNCoC0 to FRACTAL_NZ,
     * to NCHW first, then to FRACTAL_NZ */
    {SRC_FORMAT(ge::FORMAT_C1HWNCoC0) | ge::FORMAT_FRACTAL_NZ, {TRANSDATA_INDEX, TRANSDATA_INDEX}},

    /* CHWN to NCHW */
    {SRC_FORMAT(ge::FORMAT_CHWN) | ge::FORMAT_NCHW, {TRANSDATA_INDEX}},
    /* CHWN to NHWC */
    {SRC_FORMAT(ge::FORMAT_CHWN) | ge::FORMAT_NHWC, {TRANSDATA_INDEX}},
    /* CHWN to HWCN */
    {SRC_FORMAT(ge::FORMAT_CHWN) | ge::FORMAT_HWCN, {TRANSDATA_INDEX}},
    /* CHWN to CHWN */
    {SRC_FORMAT(ge::FORMAT_CHWN) | ge::FORMAT_CHWN, {}},
    /* CHWN to Fractal_Z, to NCHW first then to fz Dtype does ot Change */
    {SRC_FORMAT(ge::FORMAT_CHWN) | ge::FORMAT_FRACTAL_Z, {TRANSPOSE_INDEX, TRANSDATA_INDEX}},
    /* CHWN to NC1HWC0, to NCHW first then to 5D Dtype does ot Change */
    {SRC_FORMAT(ge::FORMAT_CHWN) | ge::FORMAT_NC1HWC0, {TRANSPOSE_INDEX, TRANSDATA_INDEX}},

    /* NHWC to ND */
    {SRC_FORMAT(ge::FORMAT_NHWC) | ge::FORMAT_ND, {}},
    /* NCHW to ND */
    {SRC_FORMAT(ge::FORMAT_NCHW) | ge::FORMAT_ND, {}},
    /* HWCN to ND */
    {SRC_FORMAT(ge::FORMAT_HWCN) | ge::FORMAT_ND, {}},
    /* NCDHW to ND */
    {SRC_FORMAT(ge::FORMAT_NCDHW) | ge::FORMAT_ND, {}},
    /* NDHWC to ND */
    {SRC_FORMAT(ge::FORMAT_NDHWC) | ge::FORMAT_ND, {}},
    /* DHWCN to ND */
    {SRC_FORMAT(ge::FORMAT_DHWCN) | ge::FORMAT_ND, {}},
    /* DHWNC to ND */
    {SRC_FORMAT(ge::FORMAT_DHWNC) | ge::FORMAT_ND, {}},
    /* FRACTAL_NZ to ND */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_NZ) | ge::FORMAT_ND, {TRANSDATA_INDEX}},

    /* ND to ND */
    {SRC_FORMAT(ge::FORMAT_ND) | ge::FORMAT_ND, {}},
    /* ND to NCHW */
    {SRC_FORMAT(ge::FORMAT_ND) | ge::FORMAT_NCHW, {}},
    /* ND to NHWC */
    {SRC_FORMAT(ge::FORMAT_ND) | ge::FORMAT_NHWC, {}},
    /* ND to HWCN */
    {SRC_FORMAT(ge::FORMAT_ND) | ge::FORMAT_HWCN, {}},
    /* ND to NCDHW */
    {SRC_FORMAT(ge::FORMAT_ND) | ge::FORMAT_NCDHW, {}},
    /* ND to NDHWC */
    {SRC_FORMAT(ge::FORMAT_ND) | ge::FORMAT_NDHWC, {}},
    /* ND to DHWCN */
    {SRC_FORMAT(ge::FORMAT_ND) | ge::FORMAT_DHWCN, {}},
    /* ND to DHWNC */
    {SRC_FORMAT(ge::FORMAT_ND) | ge::FORMAT_DHWNC, {}},
    /* ND to FRACTAL_NZ */
    {SRC_FORMAT(ge::FORMAT_ND) | ge::FORMAT_FRACTAL_NZ, {TRANSDATA_INDEX}},
    /* ND to FRACTAL_Z */
    {SRC_FORMAT(ge::FORMAT_ND) | ge::FORMAT_FRACTAL_Z, {TRANSDATA_INDEX}},
    /* ND to NC1HWC0 */
    {SRC_FORMAT(ge::FORMAT_ND) | ge::FORMAT_NC1HWC0, {FORBIDDEN_INDEX}},

    /* FRACTAL_NZ to NCHW */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_NZ) | ge::FORMAT_NCHW, {TRANSDATA_INDEX, REFORMAT_INEDX}},
    /* FRACTAL_NZ to NHWC */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_NZ) | ge::FORMAT_NHWC, {TRANSDATA_INDEX, REFORMAT_INEDX}},
    /* FRACTAL_NZ to HWCN */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_NZ) | ge::FORMAT_HWCN, {TRANSDATA_INDEX, REFORMAT_INEDX}},
    /* FRACTAL_NZ to FRACTAL_Z
     * to original format first, then to FRACTAL_Z */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_NZ) | ge::FORMAT_FRACTAL_Z, {TRANSDATA_INDEX, TRANSPOSE_INDEX, TRANSDATA_INDEX}},
    /* FRACTAL_NZ to NC1HWC0
     * to original format first, then to NC1HWC0 */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_NZ) | ge::FORMAT_NC1HWC0, {TRANSDATA_INDEX, TRANSPOSE_INDEX, TRANSDATA_INDEX}},
    /* FRACTAL_NZ to C1HWNCoC0
     * to original format first, then to HWCN, then to C1HWNCoC0 */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_NZ) | ge::FORMAT_C1HWNCoC0, {TRANSDATA_INDEX, TRANSPOSE_INDEX, TRANSDATA_INDEX}},
    /* FRACTAL_NZ to FRACTAL_NZ */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_NZ) | ge::FORMAT_FRACTAL_NZ, {}},

    /*************************************NCDHW*************************************/
    // NCDHW -> NDC1HWC0
    {SRC_FORMAT(ge::FORMAT_NCDHW) | ge::FORMAT_NDC1HWC0, {TRANSDATA_INDEX}},
    // NCDHW -> FORMAT_FRACTAL_Z_3D
    {SRC_FORMAT(ge::FORMAT_NCDHW) | ge::FORMAT_FRACTAL_Z_3D, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    // NCDHW -> NDHWC
    {SRC_FORMAT(ge::FORMAT_NCDHW) | ge::FORMAT_NCDHW, {}},

    /*************************************NDHWC*************************************/
    // NDHWC -> NDC1HWC0
    {SRC_FORMAT(ge::FORMAT_NDHWC) | ge::FORMAT_NDC1HWC0, {TRANSDATA_INDEX}},
    // NDHWC -> FRACTAL_NZ
    {SRC_FORMAT(ge::FORMAT_NDHWC) | ge::FORMAT_FRACTAL_NZ, {TRANSDATA_INDEX}},
    // NDHWC -> FORMAT_FRACTAL_Z_3D
    {SRC_FORMAT(ge::FORMAT_NDHWC) | ge::FORMAT_FRACTAL_Z_3D, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    // NDHWC -> NDHWC
    {SRC_FORMAT(ge::FORMAT_NDHWC) | ge::FORMAT_NDHWC, {}},

    /*************************************NDC1HWC0*************************************/
    // NDC1HWC0 -> NDHWC
    {SRC_FORMAT(ge::FORMAT_NDC1HWC0) | ge::FORMAT_NDHWC, {TRANSDATA_INDEX}},
    // NDC1HWC0 -> NCDHW
    {SRC_FORMAT(ge::FORMAT_NDC1HWC0) | ge::FORMAT_NCDHW, {TRANSDATA_INDEX}},
    // NDC1HWC0 -> NDC1HWC0
    {SRC_FORMAT(ge::FORMAT_NDC1HWC0) | ge::FORMAT_NDC1HWC0, {}},

    /*************************************DHWCN*************************************/
    // DHWCK - > FRACTAL_Z_3D
    {SRC_FORMAT(ge::FORMAT_DHWCN) | ge::FORMAT_FRACTAL_Z_3D, {TRANSDATA_INDEX, RESHAPE_INDEX}},
    // DHWCK -> DHWCK
    {SRC_FORMAT(ge::FORMAT_DHWCN) | ge::FORMAT_DHWCN, {}},

    /*************************************DHWNC*************************************/
    // DHWNC -> FORMAT_FRACTAL_Z_3D_TRANSPOSE
    {SRC_FORMAT(ge::FORMAT_DHWNC) | ge::FORMAT_FRACTAL_Z_3D_TRANSPOSE, {TRANSDATA_INDEX}},
    // DHWNC -> FORMAT_FRACTAL_Z_3D_TRANSPOSE
    {SRC_FORMAT(ge::FORMAT_DHWNC) | ge::FORMAT_DHWNC, {}},

    /*************************************FRACTAL_Z_3D*************************************/
    // FRACTAL_Z_3D -> NDHWC
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z_3D) | ge::FORMAT_NDHWC, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    // FRACTAL_Z_3D -> NCDHW
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z_3D) | ge::FORMAT_NCDHW, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    // FRACTAL_Z_3D -> DHWCN
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z_3D) | ge::FORMAT_DHWCN, {RESHAPE_INDEX, TRANSDATA_INDEX}},
    // FRACTAL_Z_3D -> FRACTAL_Z_3D
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z_3D) | ge::FORMAT_FRACTAL_Z_3D, {}},

    /*************************************FRACTAL_Z_3D_TRANSPOSE***********************************/
    /* FRACTAL_Z_3D to DHWNC */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z_3D_TRANSPOSE) | ge::FORMAT_DHWNC, {TRANSDATA_INDEX}},
    /* FRACTAL_Z_3D to DHWCN */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_Z_3D_TRANSPOSE) | ge::FORMAT_FRACTAL_Z_3D_TRANSPOSE, {}},

    /*************************************FRACTAL_ZN_LSTM***********************************/
    /* FORMAT_FRACTAL_ZN_LSTM to HWCN */
    {SRC_FORMAT(ge::FORMAT_FRACTAL_ZN_LSTM) | ge::FORMAT_HWCN, {TRANSDATA_INDEX}},
    {SRC_FORMAT(ge::FORMAT_FRACTAL_ZN_LSTM) | ge::FORMAT_FRACTAL_ZN_LSTM, {}},
};
}  // namespace fe

#endif  // FUSION_ENGINE_OPTIMIZER_GRAPH_OPTIMIZER_SHAPE_FORMAT_TRANSFER_TRANS_NODE_MANAGER_TRANS_NODE_INSERTION_INSERT_TRANS_NODE_STRATEGY_H_
